﻿using System;

using Fuse8.DomainFramework.Common;

namespace Fuse8.DomainFramework.Domain
{
    /// <summary>
    /// 
    /// </summary>
    /// <typeparam name="TEntity"></typeparam>
    /// <typeparam name="TEntityCommandParameter"></typeparam>
    public abstract class BaseEntityParameterCommand<TEntity, TEntityCommandParameter> : BaseEntityCommand<TEntity>, IEntityParameterCommand<TEntity>
        where TEntity : class, IEntityObject
        where TEntityCommandParameter : class, IEntityCommandParameter
    {
        /// <summary>
        /// 
        /// </summary>
        public virtual TEntityCommandParameter CommandParameter { get; set; }

        #region IEntityCommand<TEntity> Members

        /// <summary>
        /// 
        /// </summary>
        /// <param name="parameter"></param>
        public virtual void ConfigureCommand(IEntityCommandParameter parameter)
        {
            Guard.ArgumentNotNull(parameter, "parameter");

            var commandParameter = (TEntityCommandParameter)parameter;

            if (commandParameter != null)
            {
                CommandParameter = commandParameter;
            }
        }

        #endregion
    }
}
